package ibmetp.mis.controller.user;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 注销用户
 * @author BIN
 *
 */
public class UserLogoutServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
    public UserLogoutServlet() {
        
    }

	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    HttpSession session=request.getSession();
		Enumeration<?> enums = session.getAttributeNames();
		while(enums.hasMoreElements()){
			session.removeAttribute(enums.nextElement().toString());
		}
	    session.invalidate();
		request.getSession().getServletContext().getRequestDispatcher("/index.jsp").forward(request,response);
	}

}
